﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using UmlDesigner.Model;

namespace UmlDesigner.Gui
{
    public partial class NewAttributeForm : Form
    {
        internal NewAttributeForm(UmlDesigner.Model.Attribute a)
        {
            InitializeComponent();

            attr = a;

            nameTextBox.Text = attr.name;
            typeTextBox.Text = attr.type;
            accessTypeComboBox.Text = attr.accessLevel;
        }

        private void button1_Click(object sender, EventArgs e)
        {
            attr.accessLevel = accessTypeComboBox.Text;
            attr.name = nameTextBox.Text;
            attr.type = typeTextBox.Text;
        }

        private void button3_Click(object sender, EventArgs e)
        {
            TypeSelectionForm dlg = new TypeSelectionForm();
            if (dlg.ShowDialog() == DialogResult.OK)
            {
                typeTextBox.Text = dlg.selectedType;
            }
        }

        UmlDesigner.Model.Attribute attr;

    }
}
